package com.firefly.service.repository.mc;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.firefly.dao.dao.mc.po.McRolePo;
import com.firefly.dao.dao.mc.service.McRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description:
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2023/1/31
 **/
@Repository
public class McRoleRepository {
    private final McRoleService roleService;
    @Autowired
    public McRoleRepository(McRoleService roleService){
        this.roleService = roleService;
    }
    public Boolean create(McRolePo entity){
        return roleService.save(entity);
    }
    public Boolean update(McRolePo entity){
        return roleService.updateById(entity);
    }
    public Boolean updateStatus(McRolePo entity) {
        UpdateWrapper<McRolePo> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id", entity.getId());
        updateWrapper.set("status", entity.getStatus());
        return roleService.update(updateWrapper);
    }

    public Boolean removeById(int id){
        return roleService.removeById(id);
    }
    public Boolean removeById(List<Integer> ids){
        return roleService.removeByIds(ids);
    }
}
